<?php
class EvaluatedphysiciansController extends AppController{
	public function insert($data){
		$this->data['Evaluatedphysician']['claimid']=$data[0];
		$this->data['Evaluatedphysician']['firstname']=$data[1];
		$this->data['Evaluatedphysician']['middlename']=$data[2];
		$this->data['Evaluatedphysician']['lastname']=$data[3];
		$this->data['Evaluatedphysician']['accreditationcode']=$data[4];
		$this->data['Evaluatedphysician']['serviceperformed']='Daily visit';
		$this->data['Evaluatedphysician']['dailyrate']=$data[5];
		$this->data['Evaluatedphysician']['dayscovered']=$data[6];
		$this->data['Evaluatedphysician']['actualcharge']=str_replace(',', '', $data[7]);
		$this->data['Evaluatedphysician']['benifitclaim']=str_replace(',', '', $data[8]);		

		$this->Evaluatedphysician->create();
		$this->Evaluatedphysician->save($this->data);
	}
	public function getPhysician($claimid){
		$this->view='Json';
		
		$condition=array('claimid'=>$claimid);
		$data=$this->Evaluatedphysician->find('all', array('conditions'=>$condition));
		
		$this->set('data', $data);									
		$this->set('json', 'data');		
	}
	public function setStatus($id, $status){
		$this->data['Evaluatedphysician']['id']=$id;
		$this->data['Evaluatedphysician']['status']=$status;
		
		$this->Evaluatedphysician->save($this->data);
	}
	public function update(){
		//data: 'id='+id+'&dailyrate='+rate+'&dayscovered='+days,
		$id=$_POST['id'];
		$dailyrate=$_POST['dailyrate'];
		$dayscovered=$_POST['dayscovered'];
		$total=$dailyrate*$dayscovered;
		
		$this->data['Evaluatedphysician']['id']=$id;
		$this->data['Evaluatedphysician']['dailyrate']=$dailyrate;
		$this->data['Evaluatedphysician']['dayscovered']=$dayscovered;		
		$this->data['Evaluatedphysician']['benifitclaim']=$total;
		
		$this->Evaluatedphysician->save($this->data);
	}
}
?>